package com.rlz.framemm.model

import com.rlz.base.base.BaseModel
import com.rlz.base.util.ToastUtils
import com.rlz.framemm.api.TestApi
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.async
import kotlinx.coroutines.coroutineScope
import kotlinx.coroutines.withContext

/**
 * Created by RLZ
 * on 2021/10/20
 *
 */
class TestModel : BaseModel() {

    suspend fun getBanners() = withContext(Dispatchers.IO) {
        coroutineScope {
            val bannerList =
                async { createService(TestApi::class.java).getBanners() }
            bannerList.await()
        }
    }
}
